﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


class Program
{
    public static void On_Changed(object sender, FileSystemEventArgs e)
    {
        Console.WriteLine("File changed");
    }

    public static void On_Rename(object sender, FileSystemEventArgs e)
    {
        Console.WriteLine("File reanmed to {0}", e.Name);
    }

    static void Main()
    {
        FileSystemWatcher watcher = new FileSystemWatcher(@"C:\TEST\ToCopy\smtch", @"some some.txt");
        Console.WriteLine(@"Press enter to stop or change file 'C:\TEST\ToCopy\smtch\some some.txt' to see " +
                            "whether the messages are correct.");
        watcher.EnableRaisingEvents = true;
        watcher.NotifyFilter = NotifyFilters.Size;
        watcher.Changed += new FileSystemEventHandler(On_Changed);
        watcher.Renamed += new RenamedEventHandler(On_Rename);
        Console.ReadLine();        
    }
}
